export default {
	// 开启命名空间
	namespaced: true,

	// state 数据
	state: {
		index: 0,
		tabBarList: [{
				name: '音乐',
				icon: '../../static/tab_icons/t_audio.png',
				icon_active: '../../static/tab_icons/t_audio_active.png',
				navigator: '/pages/audio/audio'
			},
			{
				name: '聊天',
				icon: '../../static/tab_icons/t_chat.png',
				icon_active: '../../static/tab_icons/t_chat_active.png',
				navigator: '/pages/message/message'
			},
			{
				name: '好友',
				icon: '../../static/tab_icons/t_friend.png',
				icon_active: '../../static/tab_icons/t_friend_active.png',
				navigator: '/pages/friend/friend'
			},
			// {
			// 	name: '我的',
			// 	icon: '../../static/tab_icons/t_chat.png',
			// 	icon_active: '../../static/tab_icons/t_chat_active.png',
			// 	navigator: '/pages/my/my'
			// },
		]
	},

	// 方法
	mutations: {
		activeTab(state, i) {
			state.index = i;

			uni.switchTab({
				url: state.tabBarList[i].navigator
			})
		},
		initTab(state, route) {
			for (let i = 0; i < state.tabBarList.length; i++) {
				if (state.tabBarList[i].navigator == route) {
					state.index = i;
					uni.switchTab({
						url: state.tabBarList[i].navigator
					})
					return
				}
			}
		}
	},

	// 数据包装器
	getters: {

	},
}